package com.abigdreamer.im.server.module;

import org.apache.mina.core.session.IoSession;

import com.abigdreamer.im.message.BaseMessage;

/**
 * 用户连接对象
 */
public class UserConnect {

	private IoSession textTempSession; // 登陆零时聊天会话连接对象
	private IoSession textSession; // 聊天会话连接对象
	private IoSession fileSession; // 文件会话连接对象
	private IoSession cinemaSession; // 视频会话连接对象
	private String owerQQ; // 此会话连接对象的所有者的qq号

	public UserConnect() {
	}

	/**
	 * 对外发送聊天消息，出去视频和文件传输消息
	 * 
	 * @param message
	 */
	public void sendTextMessage(BaseMessage message) {
		textSession.write(message);
	}

	public void sendTextTempMessage(BaseMessage message) {
		textTempSession.write(message);
	}

	/**
	 * 对外发送文件消息
	 * 
	 * @param message
	 */
	public void sendFileMessage(BaseMessage message) {
		fileSession.write(message);
	}

	/**
	 * 对外发送视频消息
	 * 
	 * @param message
	 */
	public void sendCinemaMessage(BaseMessage message) {
		cinemaSession.write(message);
	}

	/**
	 * @param owerQQ
	 *            :此连接对象的所有者
	 * @param textSession
	 *            :此连接对象中的聊天会话连接对象
	 */
	public UserConnect(String owerQQ, IoSession textSession) {
		this.owerQQ = owerQQ;
		this.textSession = textSession;
	}

	public String getOwerQQ() {
		return owerQQ;
	}

	public void setOwerQQ(String owerQQ) {
		this.owerQQ = owerQQ;
	}

	public IoSession getFileSession() {
		return fileSession;
	}

	public void setFileSession(IoSession fileSession) {
		this.fileSession = fileSession;
	}

	public IoSession getLookSession() {
		return cinemaSession;
	}

	public void setLookSession(IoSession cinemaSession) {
		this.cinemaSession = cinemaSession;
	}

	public IoSession getTextTempSession() {
		return textTempSession;
	}

	public void setTextTempSession(IoSession textTempSession) {
		this.textTempSession = textTempSession;
	}

	public IoSession getTextSession() {
		return textSession;
	}

	public void setTextSession(IoSession textSession) {
		this.textSession = textSession;
	}

}
